package com.dingding.study.service.拦截返回值;

/**
 * @program: spring-learning
 * @description:
 * https://www.cnblogs.com/swzx-1213/p/12781836.html
 * https://www.cnblogs.com/lexiaoyao1995/p/13787652.html
 * https://www.meiwen.com.cn/subject/aiwgaftx.html
 * @author: liugongding
 * @create: 2021-09-24 18:06
 **/
public class ResponseResult<T> {
    //状态码
    private Integer Code;
    //提示信息
    private String Msg;
    //数据
    private T Data;

    public ResponseResult() {}

    //自定义返回结果的构造方法
    public ResponseResult(ErrorCode errorCode, T data) {
        this.Code = errorCode.getErrorCode();
        this.Msg = errorCode.getErrorMsg();
        this.Data = data;
    }

    public Integer getCode() {
        return Code;
    }

    public void setCode(Integer code) {
        Code = code;
    }

    public String getMsg() {
        return Msg;
    }

    public void setMsg(String msg) {
        Msg = msg;
    }

    public T getData() {
        return Data;
    }

    public void setData(T data) {
        Data = data;
    }

    @Override
    public String toString() {
        return "ResponseResult{" +
                "Code=" + Code +
                ", Msg='" + Msg + '\'' +
                ", Data=" + Data +
                '}';
    }
}
